package com.hbzhit.modules.oss.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hbzhit.common.utils.CacheUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;
import java.util.Date;


/**
 * 文件上传
 *
 * @author Mark sunlightcs@gmail.com
 */
@ApiModel("文件存储")
@Slf4j
@Getter
@Setter
@TableName("sys_oss")
public class SysOssEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	@ApiModelProperty("ID")
	@TableId
	private Long id;

	@ApiModelProperty("文件名称")
	private String fileName;

	@ApiModelProperty("文件大小")
	private Long fileSize;

	@ApiModelProperty("文件后缀")
	private String fileSuffix;

	@ApiModelProperty("URL地址")
	private String url;

	@ApiModelProperty("创建人")
	private Long creator;

	@ApiModelProperty("创建时间")
	private Date createTime;

	@ApiModelProperty("创建人名称")
	@TableField(exist = false)
	private String creatorName;

	public String getCreatorName() {
		return CacheUtils.getUserCache(creator).getRealName();
	}
}
